<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Jialeo\LaravelSchemaExtend\Schema;

class CreateCustomerDepartmentFollowUpRecordTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('customer_department_follow_up_record', function (Blueprint $table) {
            $table->id();
            $table->unsignedInteger('taskId')->default(0)->comment('关联任务ID');
            $table->unsignedInteger('clueId')->default(0)->comment('关联线索ID');
            $table->unsignedInteger('kpPartyId')->default(0)->comment('关联客户ID');
            $table->unsignedTinyInteger('type')->default(0)->comment('跟进类型');
            $table->unsignedTinyInteger('method')->default(0)->comment('跟进方式');
            $table->text('content')->nullable()->default('')->comment('跟进记录');
            $table->unsignedInteger('createdAt')->default(0)->comment('创建时间');
            $table->unsignedInteger('createdByUid')->default(0)->comment('创建人');
            $table->unsignedInteger('updatedAt')->default(0)->comment('修改时间');
            $table->unsignedInteger('updatedByUid')->default(0)->comment('修改人');
            $table->collation = 'utf8mb4_general_ci';
            $table->comment = '大客户部跟进记录';

            $table->index('taskId', 'idx_taskId');

        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('customer_department_follow_up_record');
    }
}
